const arr = [];

function createTodo(data) {
    $('#todolist').append(
        `<li class="aa">
                <input type="checkbox" class="check">
                <p><input type="text" value="${data}" class="text"></p>
                <a href="javascript:viod(0)" class="delete">-</a>
            </li>`
    );
    $('.one').append(`<span id="todocount">${$("#todolist li").length}</span>`)
    $('li p input').css('border', 'none')


}

// const b = $('.aa .text').val()
// console.log(b);
// arr.push(b);
// console.log(arr);

// let c = localStorage.getItem('name')
// console.log(c);




$('#title').keydown(function(evt) {
    var e = evt || event;
    var code = e.keyCode || e.which;
    if (code === 13) {
        createTodo($(this).val());
        $(this).val("");
    }
});



$('section').on('change', '.check', function() {
    if ($(this).prop('checked')) {
        $(this.parentNode).appendTo($('#donelist'));
    } else {
        $(this.parentNode).appendTo($('#todolist'));
    }
    // console.log($("#donelist li").length);

    $('.one').append(`<span id="todocount">${$("#todolist li").length}</span>`)
    $('.two').append(`<span id="donecount">${$("#donelist li").length}</span>`)

})


$('section').on('click', '.delete', function() {
    $(this.parentNode).remove();
    $('.one').append(`<span id="todocount">${$("#todolist li").length}</span>`)
    $('.two').append(`<span id="donecount">${$("#donelist li").length}</span>`)
})


$('li p input').css('border', 'none')




// localStorage.name = a